<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>BabyOS: b_protocol.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="2.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">BabyOS
   &#160;<span id="projectnumber">V2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_b9223522bb56aee4ab59f7ba381d2163.html">bos</a></li><li class="navelem"><a class="el" href="dir_f2a2cc749b6bfcea90db6730434b0bd6.html">core</a></li><li class="navelem"><a class="el" href="dir_37b66dfbfdffce01c33ebea49c49c2c3.html">inc</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">b_protocol.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="b__protocol_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#ifndef __B_PROTOCOL_H__</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#define __B_PROTOCOL_H__</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment">/*Includes ----------------------------------------------*/</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="b__config_8h.html">b_config.h</a>&quot;</span></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#if _PROTO_ENABLE</span></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="preprocessor">#if _PROTO_FID_SIZE == 2</span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="keyword">typedef</span> uint16_t        <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6e64996b66cbe6e7c3381be81a26ace4">bProtoID_t</a>;  </div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="preprocessor">#define INVALID_ID      0XFFFF</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6e64996b66cbe6e7c3381be81a26ace4">   60</a></span>&#160;<span class="keyword">typedef</span> uint32_t        <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6e64996b66cbe6e7c3381be81a26ace4">bProtoID_t</a>; </div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga483b0a38edf0c10ef4a7cb633dc8a9fc">   61</a></span>&#160;<span class="preprocessor">#define INVALID_ID      0XFFFFFFFF</span></div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="preprocessor">#if _PROTO_FLEN_SIZE == 1</span></div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6ac05dd5592f6f26adc646f931bc9d46">   65</a></span>&#160;<span class="keyword">typedef</span> uint8_t         <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6ac05dd5592f6f26adc646f931bc9d46">bProtoLen_t</a>;      </div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="keyword">typedef</span> uint16_t        <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6ac05dd5592f6f26adc646f931bc9d46">bProtoLen_t</a>;  </div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<span class="preprocessor">#pragma pack(1) </span></div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html">   78</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;{</div><div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html#a9794c0e61506b826b49b458708ae2489">   80</a></span>&#160;    uint8_t <a class="code" href="structb_protocol_head__t.html#a9794c0e61506b826b49b458708ae2489">head</a>;</div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html#aae167caeabe2e73f414d01cf05d02383">   81</a></span>&#160;    <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6e64996b66cbe6e7c3381be81a26ace4">bProtoID_t</a> <a class="code" href="structb_protocol_head__t.html#aae167caeabe2e73f414d01cf05d02383">device_id</a>;</div><div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html#a2a44ae40eb0fbcfd97bafb2cbd14e4a0">   82</a></span>&#160;    <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6ac05dd5592f6f26adc646f931bc9d46">bProtoLen_t</a> <a class="code" href="structb_protocol_head__t.html#a2a44ae40eb0fbcfd97bafb2cbd14e4a0">len</a>;</div><div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html#a4d43e8212bdc9dbee866506f04effcea">   83</a></span>&#160;    uint8_t <a class="code" href="structb_protocol_head__t.html#a4d43e8212bdc9dbee866506f04effcea">cmd</a>;</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;}<a class="code" href="structb_protocol_head__t.html">bProtocolHead_t</a>;   </div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="preprocessor">#pragma pack()</span></div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;</div><div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#gae0d351482c29e648bcbd37505726795a">   88</a></span>&#160;<span class="keyword">typedef</span> int (*<a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#gae0d351482c29e648bcbd37505726795a">pdispatch</a>)(uint8_t cmd, uint8_t *param, <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6ac05dd5592f6f26adc646f931bc9d46">bProtoLen_t</a> param_len);</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div><div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="structb_protocol_info__t.html">   90</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;{</div><div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="structb_protocol_info__t.html#a9815edc88ceb5c25e15d3b768ec3a798">   92</a></span>&#160;    <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6e64996b66cbe6e7c3381be81a26ace4">bProtoID_t</a> <a class="code" href="structb_protocol_info__t.html#a9815edc88ceb5c25e15d3b768ec3a798">id</a>;</div><div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="structb_protocol_info__t.html#a2cd7dc696687cda89345c716c8004772">   93</a></span>&#160;    <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#gae0d351482c29e648bcbd37505726795a">pdispatch</a> <a class="code" href="structb_protocol_info__t.html#a2cd7dc696687cda89345c716c8004772">f</a>;</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;}<a class="code" href="structb_protocol_info__t.html">bProtocolInfo_t</a>;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="group___p_r_o_t_o_c_o_l___exported___defines.html#ga683ebecc04749cb0016ec5ad14a2d4f2">  107</a></span>&#160;<span class="preprocessor">#define PROTOCOL_HEAD       0xFE</span></div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___p_r_o_t_o_c_o_l___exported___functions.html#gaec065fab6957ebfbeeb66bd15452f18b">bProtocolRegist</a>(<a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6e64996b66cbe6e7c3381be81a26ace4">bProtoID_t</a> <span class="keywordtype">id</span>, <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#gae0d351482c29e648bcbd37505726795a">pdispatch</a> f);</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga10d56c517345e920cdd2558df210f3bf">bProtocolSetID</a>(<span class="keywordtype">int</span> no, <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6e64996b66cbe6e7c3381be81a26ace4">bProtoID_t</a> <span class="keywordtype">id</span>);</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga827950e7086ad6bc71075a343e470fb7">bProtocolParse</a>(<span class="keywordtype">int</span> no, uint8_t *pbuf, <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6ac05dd5592f6f26adc646f931bc9d46">bProtoLen_t</a> len);</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga69bf37734f347116daeb41521a8993f8">bProtocolPack</a>(<span class="keywordtype">int</span> no, uint8_t cmd, uint8_t *param, <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6ac05dd5592f6f26adc646f931bc9d46">bProtoLen_t</a> param_size, uint8_t *pbuf);</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    }</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;<span class="preprocessor">#endif  </span></div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;<span class="comment">/************************ Copyright (c) 2019 Bean *****END OF FILE****/</span></div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;</div><div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___types_definitions_html_ga6ac05dd5592f6f26adc646f931bc9d46"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6ac05dd5592f6f26adc646f931bc9d46">bProtoLen_t</a></div><div class="ttdeci">uint8_t bProtoLen_t</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00065">b_protocol.h:65</a></div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___types_definitions_html_ga6e64996b66cbe6e7c3381be81a26ace4"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga6e64996b66cbe6e7c3381be81a26ace4">bProtoID_t</a></div><div class="ttdeci">uint32_t bProtoID_t</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00060">b_protocol.h:60</a></div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___functions_html_ga69bf37734f347116daeb41521a8993f8"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga69bf37734f347116daeb41521a8993f8">bProtocolPack</a></div><div class="ttdeci">int bProtocolPack(int no, uint8_t cmd, uint8_t *param, bProtoLen_t param_size, uint8_t *pbuf)</div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___functions_html_gaec065fab6957ebfbeeb66bd15452f18b"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___functions.html#gaec065fab6957ebfbeeb66bd15452f18b">bProtocolRegist</a></div><div class="ttdeci">int bProtocolRegist(bProtoID_t id, pdispatch f)</div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___types_definitions_html_gae0d351482c29e648bcbd37505726795a"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#gae0d351482c29e648bcbd37505726795a">pdispatch</a></div><div class="ttdeci">int(* pdispatch)(uint8_t cmd, uint8_t *param, bProtoLen_t param_len)</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00088">b_protocol.h:88</a></div></div>
<div class="ttc" id="structb_protocol_head__t_html"><div class="ttname"><a href="structb_protocol_head__t.html">bProtocolHead_t</a></div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00078">b_protocol.h:78</a></div></div>
<div class="ttc" id="structb_protocol_head__t_html_a4d43e8212bdc9dbee866506f04effcea"><div class="ttname"><a href="structb_protocol_head__t.html#a4d43e8212bdc9dbee866506f04effcea">bProtocolHead_t::cmd</a></div><div class="ttdeci">uint8_t cmd</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00083">b_protocol.h:83</a></div></div>
<div class="ttc" id="structb_protocol_info__t_html"><div class="ttname"><a href="structb_protocol_info__t.html">bProtocolInfo_t</a></div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00090">b_protocol.h:90</a></div></div>
<div class="ttc" id="structb_protocol_head__t_html_aae167caeabe2e73f414d01cf05d02383"><div class="ttname"><a href="structb_protocol_head__t.html#aae167caeabe2e73f414d01cf05d02383">bProtocolHead_t::device_id</a></div><div class="ttdeci">bProtoID_t device_id</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00081">b_protocol.h:81</a></div></div>
<div class="ttc" id="structb_protocol_info__t_html_a9815edc88ceb5c25e15d3b768ec3a798"><div class="ttname"><a href="structb_protocol_info__t.html#a9815edc88ceb5c25e15d3b768ec3a798">bProtocolInfo_t::id</a></div><div class="ttdeci">bProtoID_t id</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00092">b_protocol.h:92</a></div></div>
<div class="ttc" id="b__config_8h_html"><div class="ttname"><a href="b__config_8h.html">b_config.h</a></div></div>
<div class="ttc" id="structb_protocol_head__t_html_a2a44ae40eb0fbcfd97bafb2cbd14e4a0"><div class="ttname"><a href="structb_protocol_head__t.html#a2a44ae40eb0fbcfd97bafb2cbd14e4a0">bProtocolHead_t::len</a></div><div class="ttdeci">bProtoLen_t len</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00082">b_protocol.h:82</a></div></div>
<div class="ttc" id="structb_protocol_head__t_html_a9794c0e61506b826b49b458708ae2489"><div class="ttname"><a href="structb_protocol_head__t.html#a9794c0e61506b826b49b458708ae2489">bProtocolHead_t::head</a></div><div class="ttdeci">uint8_t head</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00080">b_protocol.h:80</a></div></div>
<div class="ttc" id="structb_protocol_info__t_html_a2cd7dc696687cda89345c716c8004772"><div class="ttname"><a href="structb_protocol_info__t.html#a2cd7dc696687cda89345c716c8004772">bProtocolInfo_t::f</a></div><div class="ttdeci">pdispatch f</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00093">b_protocol.h:93</a></div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___functions_html_ga10d56c517345e920cdd2558df210f3bf"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga10d56c517345e920cdd2558df210f3bf">bProtocolSetID</a></div><div class="ttdeci">int bProtocolSetID(int no, bProtoID_t id)</div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___functions_html_ga827950e7086ad6bc71075a343e470fb7"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga827950e7086ad6bc71075a343e470fb7">bProtocolParse</a></div><div class="ttdeci">int bProtocolParse(int no, uint8_t *pbuf, bProtoLen_t len)</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
